﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MinesweeperModel
{
    class Minesweeper : IMinesweeper
    {
        public int Columns { get; set; }
        public int Rows { get; set; }
        public int BombCount { get; set; }
        public Cell[,] Grid { get; set; }

        public void Init()
        {

            Grid = new Cell[Rows, Columns];
            PlaceBombs();
            SetCellNeighboringBombCount();
        }

        private void SetCellNeighboringBombCount()
        {
            throw new NotImplementedException();

        }

        private void PlaceBombs()
        {
            var rand = new Random();
            for (int i = 0; i <= BombCount; i++)
            {
                int x = rand.Next(0, Rows);
                int y = rand.Next(0, Columns);
                if (Grid[x, y].NeighborBombCount == Cell.BOMB)
                {
                    i--;
                    continue;
                }
                Grid[x, y].NeighborBombCount = Cell.BOMB;
            }
        }

        public void Flag(int r, int c)
        {
            throw new NotImplementedException();
        }

        public void Expose(int r, int c)
        {
            throw new NotImplementedException();
        }

        public int BombsRemaining()
        {
            throw new NotImplementedException();
        }
    }
}
